import Vue from 'vue'
import Router from 'vue-router'
import Layout from '../view/layout/Layout'
import Login from '../view/login/Login'
import authrediret from '../view/login/authredirect'
import List from '../view/programLib/List'
import PicturePool from '../view/picturePool/picturePool'
import Linklist from '../view/picturePool/Linklist'
import AddMenu from '../view/menus/addMenus'
import MenuList from '../view/menus/menulist'
import caseDetails from '../view/caseDetails/caseDetails'
import menuDetail1 from '../view/menus/menuDetail1'
import menuDetail2 from '../view/menus/menuDetail2'
import AddScheme from '../view/programLib/addScheme.vue'
import programDetail2 from '../view/programLib/programDetail2'
Vue.use(Router)

export const contantRouterMap = [
  { path: '/login', component: Login,name:'login', hidden: true },
  { path: '/authrediret', component: authrediret, hidden: true },
  {
    path: "/",
    component: Layout,
    name: "layout",
    redirect:'/pictule/list',
    children: [

    ]
  }
]


export const asyncRouterMap = [
  {
    path: "/programLib",
    component: Layout,
    name: '方案库',
    redirect:'/programLib/list',
    icon: 'faan',
    children: [
      { path: 'add', component: AddScheme, name: '新增方案' },
      { path: 'list', component: List, name: '方案' },
      { path: 'edit', component: caseDetails, name: '方案详情' },
      { path: 'edit', component: List, name: '方案修改' },
      { path: 'detail2', component: programDetail2, name: '方案详情之方案预览图' }
    ]
  },
  {
    path: "/menu",
    component: Layout,
    name: '菜单库',
    icon: 'menu',
    redirect: "/menu/list",
    children: [
      { path: 'add', component: AddMenu, name: '新增菜单' },
      { path: 'list', component: MenuList, name: '菜单详情' },
      {
        path: 'detail1',
        component: menuDetail1,
        name: '菜单详情1'
      },
      {
        path: 'detail2',
        component: menuDetail2,
        name: '菜单详情2'
      },
      { path: 'edit', component: AddMenu, name: '编辑菜单' }
    ]
  },
  {
    path: "/pictule",
    component: Layout,
    name: '素材库',
    icon: 'sucai',
    redirect: "/pictule/list",
    children: [
      { path: 'list', component: PicturePool, name: '素材新增' },
      { path: 'link', component: Linklist, name: '链接新增' }
    ]
  }
]
export default new Router({
  scrollBehavior: () => ({ y: 0 }),
  routes: contantRouterMap.concat(asyncRouterMap)
})
